package com.yangming.springboot.controller;

import com.yangming.springboot.base.ResultInfo;
import com.yangming.springboot.query.CusDevPlanQuery;
import com.yangming.springboot.service.CusDevPlanService;
import com.yangming.springboot.service.SaleChanceService;
import com.yangming.springboot.vo.CusDevPlan;
import io.swagger.models.Model;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.annotation.Resource;
import java.util.Map;

/**
 * @创建人 ym
 * @创建时间 2021/3/19 0019
 * @描述直接写Controller在父类，就表示这是一整个控制层模块儿，以value值为根路径
 **/

@Controller
@RequestMapping(value = "cus_dev_plan")
public class CusDevPlanController extends BaseController {
    
    @Resource
    private CusDevPlanService cusDevPlanService;

    @RequestMapping(value = "index")
    public String index(){
        //反正这里就是填一个前端路由地址，以前前后端不分离就是这么搞得
        return "cus_dev_plan";
    }

    @RequestMapping(value = "toCusDevPlanDataPage")
    public String toCusDevPlanDataPage(Integer sid, Model model){
//        model.addAttribute("saleChance", saleChanceService.selectBySid(sid)); //说这是什么几把作用域，但是这个model的方法好像是自己写的，model里没有这个东西
        return  "cusDevPlan";
    }

    @RequestMapping(value = "list")
    @ResponseBody
    public Map<String, Object> queryCusDevPlanByParmas(CusDevPlanQuery cusDevPlanQuery){
        return cusDevPlanService.queryCusDevPlanByParams(cusDevPlanQuery);
    }

    @RequestMapping(value = "save")
    @ResponseBody
    public ResultInfo saveCusDevPlan(CusDevPlan cusDevPlan){
        cusDevPlanService.saveCusDevPlan(cusDevPlan);
        return success("save success");
    }

    @RequestMapping(value = "update")
    @ResponseBody
    public ResultInfo updateCusDevPlan(CusDevPlan cusDevPlan){
        cusDevPlanService.updateCusDevPlan(cusDevPlan);
        return success("update success");
    }

    @RequestMapping(value = "delete")
    @ResponseBody
    public ResultInfo deleteCusDevPlan(Integer id){
        cusDevPlanService.deleteCusDevPlan(id);
        return success("delete success");
    }

}
